#include "EXmlRoot.h"
#include "DefineCommon.h"
#include "EVariant.h"
#include <Autogen/EXmlRoot_autogen.h>
#include <PluginXmlFunction.h>
#include <EItemManager.h>
#include <WidgetTree.h>
#include <WidgetsManager.h>

EXmlRoot::EXmlRoot()
{
    EXmlRoot_construct_autogen(this);
}

EXmlRoot::~EXmlRoot()
{
}
    
void EXmlRoot::ui_ReloadFromFile()
{
    // ELOG_DEBUG("reload xml from the file");

    EItemManager::instance()->getItemTreeRoot()->removeChildAll();

    EItemPtr itemRoot = PluginXmlFunction::convertXmlFileToEItem(QString(this->ui_XmlPath.data()));
    EItemManager::instance()->getItemTreeRoot()->addChild(itemRoot);
    WidgetTree* wTree = (WidgetTree*)WidgetsManager::instance()->getWidgetFromMap("WidgetTree");
    wTree->slotButtonRefresh(true);
}

